import java.util.*;

class Level
{
	private LevelController levelControl;
	private HashSet<ScriptEvent> events;
	
	public Level()
	{
		events = new HashSet<ScriptEvent>();
	}
	
	public void addEvent(ScriptEvent e)
	{
		events.add(e);
	}
	
	public void processEvents(GameState gs)
	{
		for(ScriptEvent se : events)
		{
			if(se.getTrigger().fire(gs))
			{
				se.processEvent(gs);
			}
		}
	}
	
	public void setController(LevelController lc)
	{
		levelControl = lc;
	}
	
	public void removeController()
	{
		levelControl = null;
	}
}